#pragma once
#ifndef  RECORDMESSAGET_H
#define  RECORDMESSAGET_H
#include <iostream>
#include <sstream>
#include <fstream>
#include <istream>
#include <string> 
#include <iomanip> 

#include "TH1.h"
#include "TMath.h"
#include "TLine.h"
#include "TLatex.h"
#include "TSystem.h"
#include "TStyle.h"
#include "TCanvas.h"
#include "TChain.h"
#include "src/Function/Fvector.h"

std::ostream& Choose_Print_File(bool IsRecord, std::string file_name);

template <class TMess_single>
    void RecordMessage_single(TMess_single t){
         std::cout << t << " ";
	}  

template <typename TMess1, typename... TMess2>
	void RecordMessage(std::ofstream &file_name, Int_t level, TMess1 mess, TMess2... ddata){
		bool only_on_file=false;
		if(level>10){
			only_on_file=true;
			level = level-10;
		}
        std::cout.setf(std::ios::left);
        std::string fill_inc="     ";
        std::string fill="";

        int  fillnum_inc=5;
        int  fillnum=0;
        for(int i=0;i<level;i++){
                fill+=fill_inc;
                fillnum+=fillnum_inc;
            }

        file_name << fill << std::setw(65-fillnum) << std::setfill(' ') << mess  << ":    " ;
		if(!only_on_file){
			std::cout << fill << std::setw(65-fillnum) << std::setfill(' ') << mess  << ":    " ;
		}
        int arr[]={(ShowMessage_single(ddata),0)...};
        (void)arr;
        file_name << std::endl;
		if(!only_on_file){
			std::cout << std::endl;
		}
 }





#endif
